package com.tbit.manager.api;

import com.tbit.manager.api.dto.UserDTO;
import com.tbit.manager.enums.ApiConstants;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;


/**
 * 用户管理 openfeign接口
 *
 * @author ：zhangtianyou
 * @since 2024/11/22
 */
@FeignClient(name = ApiConstants.NAME)
public interface UserApi {

    String PREFIX = ApiConstants.PREFIX + "/user";

    /**
     * 用户实名认证
     *
     * @param userId 用户id
     * @param name   用户姓名
     * @param idNO   身份证号
     */
    @GetMapping(PREFIX + "/updateNameAuth")
    void updateNameAuth(@RequestParam("userId") Integer userId, @RequestParam("name") String name,
                        @RequestParam("idNO") String idNO, @RequestParam("opName") String opName,
                        @RequestParam("opPhone") String opPhone);

    /**
     * 学生实名认证
     *
     * @param userId      用户id
     * @param studentAuth
     * @param studentIdNo
     */
    @GetMapping(PREFIX + "/updateStudentAuth")
    void updateStudentAuth(@RequestParam("userId") Integer userId, @RequestParam("studentAuth") Integer studentAuth,
                           @RequestParam("studentIdNo") String studentIdNo);

    /**
     * 清空实名认证信息
     *
     * @param userId 用户id
     */
    @GetMapping(PREFIX + "/editNameAuth")
    void editNameAuth(@RequestParam("userId") Integer userId);

    /**
     * 清空实名认证提交次数
     *
     * @param userId 用户id
     */
    @GetMapping(PREFIX + "/editNameAuthCount")
    void editNameAuthCount(@RequestParam("userId") Integer userId);

    /**
     * 清除用户欠款
     *
     * @return 是否清除成功
     */
    @PostMapping(value = PREFIX + "/clearArrears", consumes = "application/json")
    Boolean clearArrears(@RequestBody UserDTO userDTO);

    /**
     * 修改用户手机号码
     *
     * @return 是否修改成功
     */
    @PostMapping(value = PREFIX + "/updateUser", consumes = "application/json")
    Boolean updateUser(@RequestBody UserDTO userDTO);

    /**
     * 余额修改
     *
     * @param userDTO 用户实体类
     */
    @PostMapping(value = PREFIX + "/rechargeMoney", consumes = "application/json")
    void rechargeMoney(@RequestBody UserDTO userDTO);

    /**
     * 押金冻结
     *
     * @param userId       用户id
     * @param depositState 押金状态 (0:未提交押金;1:已提交押金;2:押金退还中;3:芝麻信用;4:押金冻结;5:学生认证免押金)
     */
    @GetMapping(PREFIX + "/frozenDeposit")
    void frozenDeposit(@RequestParam("userId") Integer userId, @RequestParam("depositState") Integer depositState);
}
